package cn.ywsj.ywsjmidtier.controller;

import cn.ywsj.ywsjmidtier.entity.VO.InvoiceQueryVo;
import cn.ywsj.ywsjmidtier.entity.VO.ThOrderListQueryVo;
import cn.ywsj.ywsjmidtier.entity.VO.ThOrderMainQueryVo;
import cn.ywsj.ywsjmidtier.service.WechatOrderFeign;
import cn.ywsj.ywsjmidtier.utils.JsonObjectUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "订单")
@RestController
@RequestMapping("/wechat/member/ordermgr")
public class WechatOrderController {
    @Autowired
    private WechatOrderFeign wechatOrderFeign;

    /**
     * 订单列表
     * @param listQueryVo
     * @param start
     * @param pageSize
     * @return
     */
    @ApiOperation("订单列表")
    @PostMapping("/ajaxorderlistmerge")
    public String myOrderListMerge(ThOrderListQueryVo listQueryVo,Integer start,Integer pageSize){
        return wechatOrderFeign.myOrderListMerge(JsonObjectUtil.ObjectToJson(listQueryVo),start,pageSize);
    }

    /**
     * 订单详情
     * @param thOrderListQueryVo
     * @return
     */
    @ApiOperation("订单详情")
    @PostMapping("/ajaxorderdetailmerge")
    public String ajaxOrderDetailMerge(ThOrderListQueryVo thOrderListQueryVo){
       return wechatOrderFeign.ajaxOrderDetailMerge(JsonObjectUtil.ObjectToJson(thOrderListQueryVo));
    }

    /**
     * 再次购买列表
     * @param queryVo
     * @param start
     * @param pageSize
     * @return
     */
    @ApiOperation("再次购买列表")
    @PostMapping("/ajaxbuyagainorderlist")
    public String ajaxBuyAgainOrderList(ThOrderListQueryVo queryVo,Integer start,Integer pageSize){
        return wechatOrderFeign.ajaxBuyAgainOrderList(JsonObjectUtil.ObjectToJson(queryVo),start,pageSize);
    }

    /**
     * 订单详情
     * @param thOrderListQueryVo
     * @return
     */
    @ApiOperation("订单详情")
    @PostMapping("/ajaxorderdetail")
    public String ajaxOrderDetail(ThOrderListQueryVo thOrderListQueryVo) {
        return wechatOrderFeign.ajaxOrderDetail(JsonObjectUtil.ObjectToJson(thOrderListQueryVo));
    }

    /**
     * 购物车_订单支付
     * @param thOrderMainQueryVo
     * @return
     */
    @ApiOperation("购物车_订单支付")
    @PostMapping("/ajaxmainorderpayment")
    public String ajaxMainOrderPayment(ThOrderMainQueryVo thOrderMainQueryVo) {
        return wechatOrderFeign.ajaxMainOrderPayment(JsonObjectUtil.ObjectToJson(thOrderMainQueryVo));
    }

    /**
     * 开票记录_开票详情
     * @param invoiceQueryVo
     * @return
     */
    @ApiOperation("开票记录_开票详情")
    @PostMapping("/queryinvoicedetail")
    public String queryInvoiceDetail(InvoiceQueryVo invoiceQueryVo) {
        return wechatOrderFeign.queryInvoiceDetail(JsonObjectUtil.ObjectToJson(invoiceQueryVo));
    }

    /**
     * 开票记录_开票记录列表
     * @param state
     * @param pageSize
     * @return
     */
    @ApiOperation("开票记录_开票记录列表")
    @PostMapping("/ajaxinvoicelist")
    public String invoiceList(Integer state,Integer pageSize) {
        return wechatOrderFeign.invoiceList(state,pageSize);
    }
}


